<?php

require 'dbconnect.inc.php';

$stpos=$_GET['text'];
$result=mysqli_query($link,"select * from content where '$stpos'>=spos and '$stpos'<=epos order by text,votes desc");
$i=0;
while($row=mysqli_fetch_array($result)){
    $annotations[$i]=$row['annotation'];
    $id[$i]=$row['id'];
    $i++;
}
session_start();
$_SESSION['annot']=$annotations;
$_SESSION['id']=$id;
mysqli_close($link);

header('Location: main.php');	 

?>
